<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/login.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
    <script src="<%=basepath%>js/jquery.md5.js"></script>
</head>
<body>
<%
String code = request.getParameter("code");
String state =request.getParameter("state");
%>
<div class="viewport">
    <div class="header">
        <div class="header-1">
            <a href="javascrpt:void(0)" class="header-2"></a>
            <a href="javascript:history.go(-1)" class="back">返回</a>
            <span class="span-num">WWP11100</span>
        </div>
    </div>
    <div class="content m-top">
        <form method="post" id="myform" action="/wape-web/api/core/centerService">
            <div class="content-2"><input type="text" placeholder="农商易号/手机号码" maxlength="25px" id="registerNum" name="registerNum" autocomplete="off"></div>
            <div class="content-2"><input type="password" placeholder="填写密码" name="pwd" maxlength="25px" id="password"></div>
            <input type="hidden" name="serviceCode" value="5002U01" />
            <input type="hidden" name="isWX" id="isWX">
            <input type="hidden" name="openId" id="openId">
            <div class="content-3"><input type="submit" value="登 录" class="submit"></div>
        </form>
        <div class="content-4">
            <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=w-registered-2&prefix=we&openId=${openId}&isWX=${isWX}" class="content-4-1">账号注册</a>
            <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=forgot&prefix=3g&openId=${openId}&isWX=${isWX}" class="content-4-2">忘记密码</a>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*  */
    $(function(){
        /*获取openid*/
        var openId = "${openId}";
        var isWX = "${isWX}";
        $("#openId").val(openId);
        //alert(openId);
        $("#isWX").val(isWX);
        /*表单*/
        $("#myform").submit(function(){
            var registerNum=$("#registerNum").val();
            var patrn =/^1[3,5,7,8]\d{9}$/;
            var password=$("#password").val();
            if(registerNum==""){
                layer.msg("请输入手机号码",{shadeClose:true,shade:0.1,time:2000});
                return false;
            }
            if(!patrn.test(registerNum)){
                layer.msg("输入的手机号码不正确",{shadeClose:true,shade:0.1,time:2000});
                return false;
            }
            if(password==""){
                layer.msg("请输入密码",{shadeClose:true,shade:0.1,time:2000});
                return false;
            }
            else{
                var b = $("#password").val();
                var c = $.md5($.md5($.md5(b)));
                $("#password").val(c);
                layer.load();
                setTimeout(function(){
              	  layer.closeAll();
              	  layer.msg("网络异常，请重新尝试！",{shadeClose:true,shade:0.1,time:2000});
              	}, 30000);
            }
        });
    });
</script>
</html>

